@echo off
if "%1" == "" (
	echo Please use this command: "win_kill_port <port>"
) else (
	SETLOCAL ENABLEDELAYEDEXPANSION
	set /a port_task = 0
	for /f "tokens=5" %%i in ('netstat -aon ^| findstr %1') do (
			if %%i neq 0 (
			    if !port_task! neq %%i (
			    	echo kill port task id = %%i
			    	set /a port_task = %%i
			    	taskkill /f /pid %%i
			    )
		    )
	)
)
echo exit

